#include<iostream>
#include<vector>
#include<string>

using namespace std;

class Solution {
public:
    string path;
    vector<string>ret;
    char change(char ch)
    {
        if (ch >= 'a' && ch <= 'z')ch -= 32;
        else ch += 32;
        return ch;
    }

    void dfs(string s, int pos)
    {
        if (path.size() == s.size())
        {
            ret.push_back(path);
            return;
        }

        path.push_back(s[pos]);
        dfs(s, pos + 1);
        path.pop_back();

        if (s[pos] < '0' || s[pos]>'9')
        {
            char ch = change(s[pos]);
            path += ch;
            dfs(s, pos + 1);
            path.pop_back();
        }

    }
    vector<string> letterCasePermutation(string s) {
        dfs(s, 0);
        return ret;
    }
};